home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / CellHints.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  6.5 KB  |  316 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Rectangle;
  7.  
  8. public class CellHints {
  9.    Rectangle bounds = new Rectangle();
  10.    int align;
  11.    int valign;
  12.    boolean editable = true;
  13.    boolean visible = true;
  14.    Font font;
  15.    // $FF: renamed from: fg java.awt.Color
  16.    Color field_0;
  17.    // $FF: renamed from: bg java.awt.Color
  18.    Color field_1;
  19.    Color hfg;
  20.    Color hbg;
  21.    boolean highlighted;
  22.    boolean lineTop;
  23.    boolean lineBottom;
  24.    boolean lineLeft;
  25.    boolean lineRight;
  26.    int lineTopStyle;
  27.    int lineBottomStyle;
  28.    int lineLeftStyle;
  29.    int lineRightStyle;
  30.    Color lineTopColor;
  31.    Color lineBottomColor;
  32.    Color lineLeftColor;
  33.    Color lineRightColor;
  34.    int bits;
  35.    public static final int ALIGN_BIT = 0;
  36.    public static final int VALIGN_BIT = 1;
  37.    public static final int EDITABLE_BIT = 2;
  38.    public static final int VISIBLE_BIT = 3;
  39.    public static final int FONT_BIT = 4;
  40.    public static final int FG_BIT = 5;
  41.    public static final int BG_BIT = 6;
  42.    public static final int HFG_BIT = 7;
  43.    public static final int HBG_BIT = 8;
  44.    public static Font stdFont = new Font("Dialog", 0, 12);
  45.    Grid view;
  46.    TableCell cell;
  47.  
  48.    public CellHints(Grid var1) {
  49.       this.font = stdFont;
  50.       this.field_0 = Color.black;
  51.       this.field_1 = Color.white;
  52.       this.hfg = Color.white;
  53.       this.hbg = Color.blue;
  54.       this.highlighted = false;
  55.       this.lineTop = true;
  56.       this.lineBottom = true;
  57.       this.lineLeft = true;
  58.       this.lineRight = true;
  59.       this.lineTopStyle = 1;
  60.       this.lineBottomStyle = 1;
  61.       this.lineLeftStyle = 1;
  62.       this.lineRightStyle = 1;
  63.       this.lineTopColor = Color.gray;
  64.       this.lineBottomColor = Color.gray;
  65.       this.lineLeftColor = Color.gray;
  66.       this.lineRightColor = Color.gray;
  67.       this.view = var1;
  68.    }
  69.  
  70.    public void set(int var1) {
  71.       this.bits |= 1 << var1;
  72.    }
  73.  
  74.    public void clear(int var1) {
  75.       this.bits = (int)((long)this.bits & ~(1L << var1));
  76.    }
  77.  
  78.    public boolean get(int var1) {
  79.       return (this.bits >> var1 & 1) != 0;
  80.    }
  81.  
  82.    public void setForeground(Graphics var1) {
  83.       if (this.highlighted) {
  84.          var1.setColor(this.hfg);
  85.       } else {
  86.          var1.setColor(this.field_0);
  87.       }
  88.    }
  89.  
  90.    public void setBackground(Graphics var1) {
  91.       if (this.highlighted) {
  92.          var1.setColor(this.hbg);
  93.       } else {
  94.          var1.setColor(this.field_1);
  95.       }
  96.    }
  97.  
  98.    public void setHints(TableCell var1) {
  99.       this.cell = var1;
  100.       if (this.cell.type() == 3) {
  101.          this.setCornerCellHints(var1);
  102.       } else {
  103.          if (this.cell.type() != 2) {
  104.             this.cell.type();
  105.          }
  106.  
  107.          this.bounds = this.view.getCellBounds(var1, this.bounds);
  108.          this.align = this.view.getCellAlignment(var1);
  109.          this.field_0 = this.view.getCellFG(var1);
  110.          this.field_1 = this.view.getCellBG(var1);
  111.          this.editable = this.view.getCellEditable(var1);
  112.          this.highlighted = this.view.getCellHighlighted(var1);
  113.          this.font = this.view.getCellFont(var1);
  114.       }
  115.    }
  116.  
  117.    void setCornerCellHints(TableCell var1) {
  118.       CellHints var2 = this.view.rowHeadingHints;
  119.       this.bounds = this.view.getCellBounds(var1, this.bounds);
  120.       this.align = var2.align;
  121.       this.field_0 = var2.field_0;
  122.       this.field_1 = var2.field_1;
  123.       this.editable = var2.editable;
  124.       this.highlighted = this.view.isViewSelected();
  125.       this.font = var2.font;
  126.    }
  127.  
  128.    public void drawBoundary(Graphics var1) {
  129.       Rectangle var2 = this.bounds;
  130.       if (this.lineTop) {
  131.          var1.setColor(this.lineTopColor);
  132.          var1.drawLine(var2.x, var2.y, var2.x + var2.width - 1, var2.y);
  133.       }
  134.  
  135.       if (this.lineBottom) {
  136.          var1.setColor(this.lineBottomColor);
  137.          var1.drawLine(var2.x, var2.y + var2.height - 1, var2.x + var2.width - 1, var2.y + var2.height - 1);
  138.       }
  139.  
  140.       if (this.lineLeft) {
  141.          var1.setColor(this.lineLeftColor);
  142.          var1.drawLine(var2.x, var2.y, var2.x, var2.y + var2.height - 1);
  143.       }
  144.  
  145.       if (this.lineRight) {
  146.          var1.setColor(this.lineRightColor);
  147.          var1.drawLine(var2.x + var2.width - 1, var2.y, var2.x + var2.width - 1, var2.y + var2.height - 1);
  148.       }
  149.  
  150.    }
  151.  
  152.    public boolean isVisible() {
  153.       return this.visible;
  154.    }
  155.  
  156.    public boolean cascadeIsVisible(CellHints var1, CellHints var2) {
  157.       if (var2 != null && var2.get(3)) {
  158.          return var2.visible;
  159.       } else {
  160.          return var1 != null && var1.get(3) ? var1.visible : this.visible;
  161.       }
  162.    }
  163.  
  164.    public Rectangle bounds() {
  165.       return this.bounds;
  166.    }
  167.  
  168.    public int alignment() {
  169.       return this.align;
  170.    }
  171.  
  172.    public int cascadeAlignment(CellHints var1, CellHints var2) {
  173.       if (var2 != null && var2.get(0)) {
  174.          return var2.align;
  175.       } else {
  176.          return var1 != null && var1.get(0) ? var1.align : this.align;
  177.       }
  178.    }
  179.  
  180.    public boolean editable() {
  181.       return this.editable;
  182.    }
  183.  
  184.    public boolean cascadeEditable(CellHints var1, CellHints var2) {
  185.       if (var2 != null && var2.get(2)) {
  186.          return var2.editable;
  187.       } else {
  188.          return var1 != null && var1.get(2) ? var1.editable : this.editable;
  189.       }
  190.    }
  191.  
  192.    public int vAlignment() {
  193.       return this.valign;
  194.    }
  195.  
  196.    public int cascadeVAlignment(CellHints var1, CellHints var2) {
  197.       if (var2 != null && var2.get(1)) {
  198.          return var2.valign;
  199.       } else {
  200.          return var1 != null && var1.get(1) ? var1.valign : this.valign;
  201.       }
  202.    }
  203.  
  204.    public Font font() {
  205.       return this.font;
  206.    }
  207.  
  208.    public Font cascadeFont(CellHints var1, CellHints var2) {
  209.       if (var2 != null && var2.get(4)) {
  210.          return var2.font;
  211.       } else {
  212.          return var1 != null && var1.get(4) ? var1.font : this.font;
  213.       }
  214.    }
  215.  
  216.    public Color foreground() {
  217.       return this.field_0;
  218.    }
  219.  
  220.    public Color cascadeForeground(CellHints var1, CellHints var2) {
  221.       if (var2 != null && var2.get(5)) {
  222.          return var2.field_0;
  223.       } else {
  224.          return var1 != null && var1.get(5) ? var1.field_0 : this.field_0;
  225.       }
  226.    }
  227.  
  228.    public Color background() {
  229.       return this.field_1;
  230.    }
  231.  
  232.    public Color cascadeBackground(CellHints var1, CellHints var2) {
  233.       if (var2 != null && var2.get(6)) {
  234.          return var2.field_1;
  235.       } else {
  236.          return var1 != null && var1.get(6) ? var1.field_1 : this.field_1;
  237.       }
  238.    }
  239.  
  240.    public boolean highlighted() {
  241.       return this.highlighted;
  242.    }
  243.  
  244.    public Color hlForeground() {
  245.       return this.hfg;
  246.    }
  247.  
  248.    public Color cascadeHlForeground(CellHints var1, CellHints var2) {
  249.       if (var2 != null && var2.get(7)) {
  250.          return var2.hfg;
  251.       } else {
  252.          return var1 != null && var1.get(7) ? var1.hfg : this.hfg;
  253.       }
  254.    }
  255.  
  256.    public Color hlBackground() {
  257.       return this.hbg;
  258.    }
  259.  
  260.    public Color cascadeHlBackground(CellHints var1, CellHints var2) {
  261.       if (var2 != null && var2.get(8)) {
  262.          return var2.hbg;
  263.       } else {
  264.          return var1 != null && var1.get(8) ? var1.hbg : this.hbg;
  265.       }
  266.    }
  267.  
  268.    public boolean lineTop() {
  269.       return this.lineTop;
  270.    }
  271.  
  272.    public boolean lineBottom() {
  273.       return this.lineBottom;
  274.    }
  275.  
  276.    public boolean lineLeft() {
  277.       return this.lineLeft;
  278.    }
  279.  
  280.    public boolean lineRight() {
  281.       return this.lineRight;
  282.    }
  283.  
  284.    public Color lineTopColor() {
  285.       return this.lineTopColor;
  286.    }
  287.  
  288.    public Color lineBottomColor() {
  289.       return this.lineBottomColor;
  290.    }
  291.  
  292.    public Color lineLeftColor() {
  293.       return this.lineLeftColor;
  294.    }
  295.  
  296.    public Color lineRightColor() {
  297.       return this.lineRightColor;
  298.    }
  299.  
  300.    public int lineTopStyle() {
  301.       return this.lineTopStyle;
  302.    }
  303.  
  304.    public int lineBottomStyle() {
  305.       return this.lineBottomStyle;
  306.    }
  307.  
  308.    public int lineLeftStyle() {
  309.       return this.lineLeftStyle;
  310.    }
  311.  
  312.    public int lineRightStyle() {
  313.       return this.lineRightStyle;
  314.    }
  315. }
  316.